import { createSSRApp } from 'vue'
import App from './App.vue'
import 'uno.css'
import './api'
import router from './router'
import { persistPlugin } from './store/persist'
import { useAuthStore } from './store/auth'

const pinia = createPinia()
pinia.use(persistPlugin)

export function createApp() {
  const app = createSSRApp(App)
  app.use(router)
  app.use(pinia)

  // 初始化认证状态
  const authStore = useAuthStore()
  authStore.initAuth()

  return {
    app,
  }
}
